package cn.xinfei.xdecision.common.model.common;

import com.github.pagehelper.PageInfo;
import lombok.Data;

/**
 * @author zdy
 * @since 2023-03-21
 */
@Data
public class PageResult<T, M> {

    private T klist;

    private PageInfo<M> pageInfo;

    public static <T, M> ResponseEntityDto<PageResult<T, M>> success(T klist, PageInfo<M> pageInfo) {
        ResponseEntityDto<PageResult<T, M>> responseEntityDto = new ResponseEntityDto<>();
        PageResult<T, M> pageResult = new PageResult<>();
        pageResult.setKlist(klist);
        pageInfo.setList(null);
        pageResult.setPageInfo(pageInfo);
        responseEntityDto.setStatus(ResponseEntityBuilder.RESPONSE_OK);
        responseEntityDto.setError("00000000");
        responseEntityDto.setData(pageResult);
        return responseEntityDto;
    }


}
